<html>
<head><meta charset="utf-8"><title>miri stage 2 · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html">miri stage 2</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="215044556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215044556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215044556">(Oct 30 2020 at 00:17)</a>:</h4>
<p>Sorry if this is in the docs somewhere, but why does Miri require a stage 2 compiler?</p>



<a name="215045281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215045281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215045281">(Oct 30 2020 at 00:31)</a>:</h4>
<p>it does? I thought it linked to stage 1</p>



<a name="215045942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215045942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215045942">(Oct 30 2020 at 00:44)</a>:</h4>
<p>If you try to link to stage 1 you get errors like this:</p>
<div class="codehilite"><pre><span></span><code>error[E0463]: can&#39;t find crate for `rustc_attr`
  --&gt; src/lib.rs:14:1
   |
14 | extern crate rustc_attr;
   | ^^^^^^^^^^^^^^^^^^^^^^^^ can&#39;t find crate

error: aborting due to previous error
</code></pre></div>



<a name="215045960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215045960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215045960">(Oct 30 2020 at 00:44)</a>:</h4>
<p>See <a href="https://github.com/rust-lang/rust/issues/78435#issuecomment-719054685">this</a> and <a href="https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#building-miri-with-a-locally-built-rustc">this</a>.</p>



<a name="215046181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215046181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215046181">(Oct 30 2020 at 00:48)</a>:</h4>
<p>those instructions look strange, <span class="user-mention" data-user-id="120791">@RalfJ</span> why do they suggest to build <code>src/rustc</code>?</p>



<a name="215046200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215046200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215046200">(Oct 30 2020 at 00:48)</a>:</h4>
<p>They're out of date. I have a PR to update them</p>



<a name="215046204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215046204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215046204">(Oct 30 2020 at 00:48)</a>:</h4>
<p><a href="https://github.com/rust-lang/miri/issues/1610">miri#1610</a></p>



<a name="215046235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215046235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215046235">(Oct 30 2020 at 00:49)</a>:</h4>
<p>Feel free to comment if the new instructions look incorrect (re <code>--keep-stage</code>) <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="215046320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215046320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215046320">(Oct 30 2020 at 00:50)</a>:</h4>
<p>left a comment</p>



<a name="215065945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215065945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215065945">(Oct 30 2020 at 08:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/miri.20stage.202/near/215046181">said</a>:</p>
<blockquote>
<p>those instructions look strange, <span class="user-mention silent" data-user-id="120791">RalfJ</span> why do they suggest to build <code>src/rustc</code>?</p>
</blockquote>
<p>Because that was the right thing to do when the docs were written^^</p>



<a name="215065985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215065985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215065985">(Oct 30 2020 at 08:24)</a>:</h4>
<p>now it's <code>--stage 2 compiler/rustc</code> I think</p>



<a name="215092907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215092907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215092907">(Oct 30 2020 at 13:19)</a>:</h4>
<p>Right, but that's not my question - why does miri need to build compiler/rustc?</p>



<a name="215188614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215188614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215188614">(Oct 31 2020 at 12:06)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span>  everything linked together needs to be built by the same rustc</p>



<a name="215188658"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215188658" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215188658">(Oct 31 2020 at 12:06)</a>:</h4>
<p>so when building miri, that's the stdlib, the rustc libs, and miri itself</p>



<a name="215188675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215188675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215188675">(Oct 31 2020 at 12:07)</a>:</h4>
<p>the "stage 0 rustc artifacts" were built by the bootstrap compiler, so to link miri with those, we'd have to build miri with the bootstrap compiler -- that is possible (it is what <code>x.py build --stage 0 src/tools/miri</code> does), but I have not figured out a way to do that with an out-of-tree miri build</p>



<a name="215188693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215188693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215188693">(Oct 31 2020 at 12:08)</a>:</h4>
<p>to use the <code>build/$TARGET/stage1</code> compiler to build and link miri, we need a version of librustc <em>built by that compiler</em>, and that's what <code>--stage 1 compiler/rustc</code> provides</p>



<a name="215194004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215194004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215194004">(Oct 31 2020 at 14:24)</a>:</h4>
<blockquote>
<p>the "stage 0 rustc artifacts" were built by the bootstrap compiler, so to link miri with those, we'd have to build miri with the bootstrap compiler -- that is possible (it is what <code>x.py build --stage 0 src/tools/miri</code> does), but I have not figured out a way to do that with an out-of-tree miri build</p>
</blockquote>
<p>Ok, this is the context I was missing</p>



<a name="215194018"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215194018" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215194018">(Oct 31 2020 at 14:24)</a>:</h4>
<p>I'll see if I can fix that this weekend, IIRC that would halve your compile times, right?</p>



<a name="215194155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215194155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215194155">(Oct 31 2020 at 14:28)</a>:</h4>
<p>Do you happen to remember what trouble you ran into? Using beta to build miri seems conceptually simple but if you use features from master libstd it's harder.</p>



<a name="215194182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215194182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215194182">(Oct 31 2020 at 14:29)</a>:</h4>
<p>Ah wait I'm confused again - rustc and miri have to use the <em>same</em> libstd, so you need master libstd whether you mean to use it or not</p>



<a name="215194646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215194646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215194646">(Oct 31 2020 at 14:41)</a>:</h4>
<p>One last point I'm confused on - why doesn't miri need the libstd <em>built</em> by the compiler it's linked to? Is it because miri is an interpreter and only needs the source code, not the artifacts?</p>



<a name="215194693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215194693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215194693">(Oct 31 2020 at 14:42)</a>:</h4>
<p>If so I think in an ideal world you'd only need <code>build --stage 0 compiler/rustc</code> and nothing else</p>



<a name="215195128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215195128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215195128">(Oct 31 2020 at 14:55)</a>:</h4>
<p>Miri builds the libstd itself. It needs a few flags like <code>-Zalways-encode-mir</code> and <code>--cfg miri</code> to work.</p>



<a name="215203588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215203588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215203588">(Oct 31 2020 at 18:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/miri.20stage.202/near/215194018">said</a>:</p>
<blockquote>
<p>I'll see if I can fix that this weekend, IIRC that would halve your compile times, right?</p>
</blockquote>
<p>I rarely have to build miri against a locally built rustc -- but for those rare cases it would halve the build times, yes :)</p>



<a name="215203653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215203653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215203653">(Oct 31 2020 at 18:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/miri.20stage.202/near/215194646">said</a>:</p>
<blockquote>
<p>One last point I'm confused on - why doesn't miri need the libstd <em>built</em> by the compiler it's linked to? Is it because miri is an interpreter and only needs the source code, not the artifacts?</p>
</blockquote>
<p>yeah, as  <span class="user-mention" data-user-id="133247">@bjorn3</span> said don't worry about the libstd miri needs for interpretation. that should mostly just work. the main hurdle is getting miri itself to build.</p>



<a name="215203680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215203680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215203680">(Oct 31 2020 at 18:03)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/miri.20stage.202/near/215194155">said</a>:</p>
<blockquote>
<p>Do you happen to remember what trouble you ran into? Using beta to build miri seems conceptually simple but if you use features from master libstd it's harder.</p>
</blockquote>
<p>basically this would have to replicate whatever happens for a stage 0 build in <code>x.py</code>, including <code>RUSTC_BOOTSTRAP</code>. honestly I am not sure if that's worth doing.</p>



<a name="215203684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215203684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215203684">(Oct 31 2020 at 18:03)</a>:</h4>
<p>I think <a href="https://github.com/rust-lang/rust/issues/76666">https://github.com/rust-lang/rust/issues/76666</a> is the much better fix.</p>



<a name="215203741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215203741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215203741">(Oct 31 2020 at 18:04)</a>:</h4>
<p>Then we can just do development in-tree, done. (With subtrees we are moving more towards that anyway.)<br>
So IMO something is wrong if we ever need to do an out-of-tree miri build against a locally built rustc -- so it is a waste of effort to try to make that usecase better.</p>



<a name="215203770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215203770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215203770">(Oct 31 2020 at 18:05)</a>:</h4>
<p>so if you want to help our compile times for integrated rustc-miri development, first of all <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span> and secondly I think the best way to do that is to fix <a href="https://github.com/rust-lang/rust/issues/76666">https://github.com/rust-lang/rust/issues/76666</a> :)</p>



<a name="215206407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215206407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215206407">(Oct 31 2020 at 18:58)</a>:</h4>
<p>gotcha, I'll take a look</p>



<a name="215207035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215207035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215207035">(Oct 31 2020 at 19:10)</a>:</h4>
<p>got my toes wet with <a href="https://github.com/rust-lang/miri/pull/1615">https://github.com/rust-lang/miri/pull/1615</a> :P</p>



<a name="215215373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215215373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215215373">(Oct 31 2020 at 22:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/131828-t-compiler/topic/miri.20stage.202/near/215203684">said</a>:</p>
<blockquote>
<p>I think <a href="https://github.com/rust-lang/rust/issues/76666">https://github.com/rust-lang/rust/issues/76666</a> is the much better fix.</p>
</blockquote>
<p>btw, I'm happy to have the end product be <code>x.py run miri</code>, but the steps along the way are the ones I'm talking about where x.py figures out how to build miri appropriately</p>



<a name="215216790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215216790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215216790">(Oct 31 2020 at 23:27)</a>:</h4>
<p>ok I think I found the issue: <code>RustcLink</code> does not copy all files from stage0-sysroot to stage1</p>
<div class="codehilite"><pre><span></span><code>(-bash@build-server) ~/.../src/bootstrap ▶️ ls ~/rustc2/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/ | grep attr
librustc_attr-c9569c665fea0d47.rlib
libtracing_attributes-863486f562382797.so
(-bash@build-server) ~/.../src/bootstrap ▶️ ls ~/rustc2/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/ | grep attr
</code></pre></div>



<a name="215217016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215217016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215217016">(Oct 31 2020 at 23:35)</a>:</h4>
<p>oh hmm I might just be confused - it's copying from <code>stage0-rustc</code> to <code>stage0-sysroot</code> on RustcLink</p>



<a name="215217061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215217061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215217061">(Oct 31 2020 at 23:36)</a>:</h4>
<p>ok this is a more helpful error:</p>
<div class="codehilite"><pre><span></span><code>$ CARGO_EXTRA_FLAGS=-v RUSTFLAGS=&#39;--sysroot /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0-sysroot&#39; ./miri check
error[E0514]: found crate `std` compiled by an incompatible version of rustc
  |
  = help: please recompile that crate using this compiler (rustc 1.49.0-dev)
  = note: the following crate versions were found:
          crate `std` compiled by rustc 1.48.0-beta.3 (4708ac76e 2020-10-15): /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-0684db6e7e1ba3c0.rlib
          crate `std` compiled by rustc 1.48.0-beta.3 (4708ac76e 2020-10-15): /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-0684db6e7e1ba3c0.so
</code></pre></div>



<a name="215217191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215217191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215217191">(Oct 31 2020 at 23:41)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> got it :)</p>
<div class="codehilite"><pre><span></span><code>RUSTC_BOOTSTRAP=1 RUSTFLAGS=&#39;--sysroot /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0-sysroot&#39; ./miri check
</code></pre></div>



<a name="215217195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215217195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215217195">(Oct 31 2020 at 23:41)</a>:</h4>
<p>you need the override toolchain to be the same as the stage0 compiler, so in my case <code>beta-2020-10-16</code></p>



<a name="215217238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215217238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215217238">(Oct 31 2020 at 23:42)</a>:</h4>
<p>this is without a second rustc compiler, only stage 0 artifacts</p>



<a name="215217247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215217247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215217247">(Oct 31 2020 at 23:42)</a>:</h4>
<p>now i just need to make this part of bootstrap somehow</p>



<a name="215218342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215218342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215218342">(Nov 01 2020 at 00:17)</a>:</h4>
<blockquote>
<p>= note: /usr/bin/ld: cannot find -lLLVM-11-rust-1.49.0-nightly</p>
</blockquote>
<p>well that's exciting</p>



<a name="215218487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215218487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215218487">(Nov 01 2020 at 00:21)</a>:</h4>
<p>hmm that is in <code>/home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-11-rust-1.49.0-nightly.so</code> though, and also a similar one in <code>/home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0/lib/libLLVM-11-rust-1.48.0-beta.so</code>. Nothing in <code>stage0-sysroot</code>, though.</p>



<a name="215218600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215218600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215218600">(Nov 01 2020 at 00:24)</a>:</h4>
<p>actually bootstrap does all this right already if you just run <code>x.py build src/tools/miri --stage 0</code></p>



<a name="215218616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215218616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215218616">(Nov 01 2020 at 00:25)</a>:</h4>
<p>but it then gives an error if you try to run miri directly:</p>
<div class="codehilite"><pre><span></span><code>/home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0-tools-bin/miri: error while loading shared libraries: librustc_driver-030baa9670a3b322.so: cannot open shared object file: No such file or directory
</code></pre></div>



<a name="215218774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215218774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215218774">(Nov 01 2020 at 00:30)</a>:</h4>
<p>hmm clippy also gives that error, let me see how they do it</p>



<a name="215219405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215219405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215219405">(Nov 01 2020 at 00:51)</a>:</h4>
<p>ok good news: <code>cp build/x86_64-unknown-linux-gnu/stage0-tools-bin/{cargo-,}miri stage1/bin</code> works fine and lets me run <code>cargo +stage1 miri</code></p>



<a name="215219515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215219515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215219515">(Nov 01 2020 at 00:54)</a>:</h4>
<p>I spoke too soon :(</p>
<div class="codehilite"><pre><span></span><code>error: duplicate lang item in crate `core` (which `rustc_std_workspace_core` depends on): `bool`.
  |
  = note: the lang item is first defined in crate `core` (which `getrandom` depends on)
  = note: first definition in `core` loaded from /home/joshua/.cache/miri/HOST/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-8b06c027fb65a14d.rmeta
  = note: second definition in `core` loaded from /home/joshua/.local/lib/cargo/target/x86_64-unknown-linux-gnu/debug/deps/libcore-7c80658520e68438.rmeta
</code></pre></div>



<a name="215219632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215219632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215219632">(Nov 01 2020 at 00:59)</a>:</h4>
<p>hmm this seems like it could be a bug in miri? I would expect it to filter out all sysroots except the one currently being used</p>



<a name="215233142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215233142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215233142">(Nov 01 2020 at 08:10)</a>:</h4>
<blockquote>
<p>where x.py figures out how to build miri appropriately</p>
</blockquote>
<p>But x.py can already build <em>and run</em> miri appropriately? <code>./x.py test --stage 0 src/tools/miri</code> works! I thought I said that every time we talked about this.^^ Sorry of I was not clear enough.</p>



<a name="215233152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215233152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215233152">(Nov 01 2020 at 08:10)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/miri.20stage.202/near/215217191">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> got it :)</p>
<div class="codehilite"><pre><span></span><code>RUSTC_BOOTSTRAP=1 RUSTFLAGS=&#39;--sysroot /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0-sysroot&#39; ./miri check
</code></pre></div>
</blockquote>
<p>what folder were you using for the rustup toolchain here?<br>
EDIT: ah, the bootstrap beta</p>



<a name="215233212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215233212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215233212">(Nov 01 2020 at 08:12)</a>:</h4>
<blockquote>
<p>hmm this seems like it could be a bug in miri? I would expect it to filter out all sysroots except the one currently being used</p>
</blockquote>
<p>Miri is just a rebranded rustc, so that would make it a rustc bug. Also I think rustc only has one sysroot at a time.</p>



<a name="215233224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215233224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215233224">(Nov 01 2020 at 08:13)</a>:</h4>
<p>One thing this reminds me of is that the stage0 folder is different from the stage1/2 folders... I dont recall the details but I recall @eddyb saying that.^^ bootstrap is treating it a bit differently.</p>



<a name="215233226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215233226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215233226">(Nov 01 2020 at 08:13)</a>:</h4>
<p>so it might be easier to figure this out in bootstrap itself</p>



<a name="215233227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215233227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215233227">(Nov 01 2020 at 08:13)</a>:</h4>
<p>otherwise you'll have to reinvent everything that bootstrap already does</p>



<a name="215237594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215237594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215237594">(Nov 01 2020 at 10:24)</a>:</h4>
<blockquote>
<p>x.py test --stage 0 src/tools/miri</p>
</blockquote>
<p>This does not work for me locally:</p>
<div class="codehilite"><pre><span></span><code>Running `build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/cargo-miri miri setup`
thread &#39;main&#39; panicked at &#39;failed to determine underlying rustc version of Miri: UnexpectedVersionFormat&#39;, src/tools/miri/cargo-miri/bin.rs:132:38
</code></pre></div>



<a name="215951878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215951878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215951878">(Nov 07 2020 at 11:59)</a>:</h4>
<p>this used to work, but maybe some change in the last few weeks broke it</p>



<a name="215953689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215953689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215953689">(Nov 07 2020 at 12:55)</a>:</h4>
<p>Indeed I am getting the same error. This is a regression.</p>



<a name="215958919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215958919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215958919">(Nov 07 2020 at 15:04)</a>:</h4>
<p>when cargo-miri runs miri, it gets a shared lib error:</p>
<div class="codehilite"><pre><span></span><code>/home/r/src/rust/rustc.3/build/x86_64-unknown-linux-gnu/stage0-tools-bin/miri: error while loading shared libraries: libLLVM-11-rust-1.49.0-nightly.so: cannot open shared object file: No such file or directory
</code></pre></div>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> any idea what this could be caused by?</p>



<a name="215958937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215958937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215958937">(Nov 07 2020 at 15:05)</a>:</h4>
<p>hm, yes, I have some ideas</p>



<a name="215958945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215958945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215958945">(Nov 07 2020 at 15:05)</a>:</h4>
<p>that file exists in <code>build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-11-rust-1.49.0-nightly.so</code></p>



<a name="215958953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215958953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215958953">(Nov 07 2020 at 15:05)</a>:</h4>
<p>so maybe that needs to be added to the lib search path, or the rpath needs to be fixed, or so?</p>



<a name="215959001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959001">(Nov 07 2020 at 15:06)</a>:</h4>
<p>That path should not be in any search path, no</p>



<a name="215959004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959004">(Nov 07 2020 at 15:06)</a>:</h4>
<p>Some other tools are also hitting this: <a href="https://github.com/rust-lang/rust/issues/78778">https://github.com/rust-lang/rust/issues/78778</a></p>



<a name="215959006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959006">(Nov 07 2020 at 15:06)</a>:</h4>
<p>or at least I wouldn't expect it to be</p>



<a name="215959010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959010">(Nov 07 2020 at 15:06)</a>:</h4>
<p>well, whatever makes it so that rustc finds that .so, needs to also happen for miri</p>



<a name="215959023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959023">(Nov 07 2020 at 15:06)</a>:</h4>
<p>yes, I think that <em>probably</em> means we need a stage0-tools-bin/lib/libLLVM perhaps?</p>



<a name="215959029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959029">(Nov 07 2020 at 15:07)</a>:</h4>
<p>I think it works for rustc because it's only ever run after uplifting to stage 1</p>



<a name="215959033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959033">(Nov 07 2020 at 15:07)</a>:</h4>
<p>At which point the .so is copied where it needs to go</p>



<a name="215959037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959037">(Nov 07 2020 at 15:07)</a>:</h4>
<p>and/or we should not have a stage0-tools-bin where we run binaries from, and instead copy the miri binary into stageN/bin/</p>



<a name="215959042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959042">(Nov 07 2020 at 15:07)</a>:</h4>
<p>(though in stage0 that's annoying because the sysroot miri wants is not the stage0/ directory)</p>



<a name="215959084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959084">(Nov 07 2020 at 15:08)</a>:</h4>
<p>My guess is that the bug/problem was introduced by the cranelift PR</p>



<a name="215959085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959085">(Nov 07 2020 at 15:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/131828-t-compiler/topic/miri.20stage.202/near/215959037">said</a>:</p>
<blockquote>
<p>and/or we should not have a stage0-tools-bin where we run binaries from, and instead copy the miri binary into stageN/bin/</p>
</blockquote>
<p>that would also fix <a href="https://github.com/rust-lang/rustup/issues/2548">https://github.com/rust-lang/rustup/issues/2548</a> I think</p>



<a name="215959093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959093">(Nov 07 2020 at 15:08)</a>:</h4>
<p>Possibly.</p>



<a name="215959097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959097">(Nov 07 2020 at 15:09)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/131828-t-compiler/topic/miri.20stage.202/near/215959037">said</a>:</p>
<blockquote>
<p>and/or we should not have a stage0-tools-bin where we run binaries from, and instead copy the miri binary into stageN/bin/</p>
</blockquote>
<p>that sounds like miri should get the same stage handling as rustc, so it should be <code>--stage 1</code> and mean "use the stage 1 compiler/miri (as produced during stage0 builds)"</p>



<a name="215959102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959102">(Nov 07 2020 at 15:09)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/131828-t-compiler/topic/miri.20stage.202/near/215959084">said</a>:</p>
<blockquote>
<p>My guess is that the bug/problem was introduced by the cranelift PR</p>
</blockquote>
<p>ah, I would have guessed the download-LLVM-from-CI changes</p>



<a name="215959104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959104">(Nov 07 2020 at 15:09)</a>:</h4>
<p>if that is worth testing I could do that</p>



<a name="215959154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959154">(Nov 07 2020 at 15:10)</a>:</h4>
<p>download-LLVM-from-CI could be indirectly responsible by making your local build a shared link to LLVM (not the default on most platforms)</p>



<a name="215959159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959159">(Nov 07 2020 at 15:10)</a>:</h4>
<p>that said, on master at least right now I can't seem to reproduce</p>



<a name="215959162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959162">(Nov 07 2020 at 15:10)</a>:</h4>
<div class="codehilite"><pre><span></span><code>thread &#39;main&#39; panicked at &#39;failed to determine underlying rustc version of Miri: UnexpectedVersionFormat&#39;, src/tools/miri/cargo-miri/bin.rs:132:38
stack backtrace:
   0: rust_begin_unwind
             at ./library/std/src/panicking.rs:495:5
   1: core::panicking::panic_fmt
             at ./library/core/src/panicking.rs:92:14
   2: core::result::unwrap_failed
             at ./library/core/src/result.rs:1220:5
   3: core::result::Result&lt;T,E&gt;::expect
             at ./library/core/src/result.rs:933:23
   4: cargo_miri::version_info
             at ./src/tools/miri/cargo-miri/bin.rs:132:5
   5: cargo_miri::setup
             at ./src/tools/miri/cargo-miri/bin.rs:325:16
   6: cargo_miri::phase_cargo_miri
             at ./src/tools/miri/cargo-miri/bin.rs:417:5
   7: cargo_miri::main
             at ./src/tools/miri/cargo-miri/bin.rs:756:25
   8: core::ops::function::FnOnce::call_once
             at ./library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
</code></pre></div>



<a name="215959166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959166">(Nov 07 2020 at 15:11)</a>:</h4>
<p>that's the same error, yeah</p>



<a name="215959170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959170">(Nov 07 2020 at 15:11)</a>:</h4>
<p>miri just reports it badly</p>



<a name="215959177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959177">(Nov 07 2020 at 15:11)</a>:</h4>
<p>oh, is miri doing like .output() or something on a rustc invocation?</p>



<a name="215959184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959184">(Nov 07 2020 at 15:11)</a>:</h4>
<p>I can't see anything in <a href="https://github.com/rust-lang/rust/issues/77975">#77975</a> that could have caused this.</p>



<a name="215959222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959222">(Nov 07 2020 at 15:12)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> yeah I think the diagnosis may have been flawed, I think it is indeed that this just never worked with a shared llvm</p>



<a name="215959292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959292">(Nov 07 2020 at 15:14)</a>:</h4>
<p>I think the fix is indeed that these tools should not be run without being in the sysroot (or I guess we can try to compile them with a really weird rpath of like ../../stageN/lib but that seems bad</p>



<a name="215959522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215959522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215959522">(Nov 07 2020 at 15:21)</a>:</h4>
<p>+1 to putting more things in sysroot, that seems more consistent overall to me</p>



<a name="215960464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215960464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215960464">(Nov 07 2020 at 15:44)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/131828-t-compiler/topic/miri.20stage.202/near/215959177">said</a>:</p>
<blockquote>
<p>oh, is miri doing like .output() or something on a rustc invocation?</p>
</blockquote>
<p>yes -- it uses <code>rustc_version</code> to figure out the host architecture</p>



<a name="215960496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215960496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215960496">(Nov 07 2020 at 15:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/131828-t-compiler/topic/miri.20stage.202/near/215959170">said</a>:</p>
<blockquote>
<p>miri just reports it badly</p>
</blockquote>
<p>s/miri/rustc_version/<br>
miri just forwards the error it gets from that library</p>



<a name="215960531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215960531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215960531">(Nov 07 2020 at 15:45)</a>:</h4>
<p>/me gleefully starts opening issues</p>



<a name="215960661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/miri%20stage%202/near/215960661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/miri.20stage.202.html#215960661">(Nov 07 2020 at 15:48)</a>:</h4>
<p><a href="https://github.com/Kimundi/rustc-version-rs/issues/33">https://github.com/Kimundi/rustc-version-rs/issues/33</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>